package com.workplan.client.widgets.userinfo;

import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;

import com.general.client.action.ActionHandler;
import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.user.client.Window;

public class UserInfoPresenterImpl extends
		WidgetPresenter<UserInfoPresenter.Display> implements UserInfoPresenter {

	public UserInfoPresenterImpl(Display display, EventBus eventBus) {
		super(display, eventBus);
	}

	@Override
	protected void onBind() {
		// TODO listen to event when the user signs in
		// and then to fetch user info via service
		display.setUserName("Nadav Greenberg");
		display.setCompanyName("Software Inc.");
		display.addSignOutActionHandler(new ActionHandler() {

			@Override
			public <H extends EventHandler> void onAction(GwtEvent<H> event) {
				Window.alert("sign out");
			}
		});

	}

	@Override
	protected void onUnbind() {
	}

	@Override
	protected void onRevealDisplay() {
	}

}
